/*global define, console */

define(['angular', 'require', 'base'], function (angular, require, base) {
    "use strict";

    var factory = function ($rootScope, $http,$ionicLoading, CommonService, LocalCacheService) {

        return {
            /**
             * 查询栏目
             */
            getChannelInfos : function(channel_ids){
                return _ajax("/funds/"+channel_ids+"/channels");
            },
        };

        /**
         * 内部调用ajax方法
         * @param url
         * @private
         */
        function _ajax(url,data){
            var params = {};
            params.url = url;
            params.type = "get";
            params.cache = true;
            if(data) {
                params.data = data;
            }
            return CommonService.ajax(params);
        }

        function _ajaxNoCache(url, data) {
            var params = {};
            params.url = url;
            params.type = "get";
            params.cache = false;
            if (data) {
                params.data = data;
            }
            return CommonService.ajax(params);
        }
    };

    factory.$inject = ['$rootScope', '$http','$ionicLoading', 'CommonService', 'LocalCacheService'];
    return factory;
});